load(
    "@cmake_configure_file//:cmake_configure_file.bzl",
    "cmake_configure_file",
)
load("@rules_cc//cc:defs.bzl", "cc_library")

package(default_visibility = ["//visibility:public"])

cmake_configure_file(
    name = "config_header",
    src = "include/GeographicLib/Config.h.in",
    out = "include/GeographicLib/Config.h",
    cmakelists = [
        "CMakeLists.txt",
    ],
    defines = [
        "GEOGRAPHICLIB_DATA=/usr/local/share/GeographicLib",
        "GEOGRAPHICLIB_HAVE_LONG_DOUBLE=0",
    ],
    visibility = ["//visibility:private"],
)

cc_library(
    name = "geographiclib",
    srcs = glob([
        "src/*.cpp",
        "src/*.hh",
    ]),
    hdrs = glob([
        "include/GeographicLib/*.hpp",
    ]) + [
        ":config_header",
    ],
    includes = [
        "include",
    ],
    visibility = ["//visibility:public"],
)
